package dao.impl;

import dao.CollectDao;
import pojo.Collect;

import java.sql.SQLException;
import java.util.List;

public class CollectDaoImpl extends BaseDao implements CollectDao {
    @Override
    public int saveCollect(Collect collect) throws SQLException {
        String sql = "insert into collect values(?,?)";
        return update(sql,collect.getCid(),collect.getClass());
    }

    @Override
    public List<Collect> getAllCollect() throws SQLException {
        String sql = "select * from collect";
        return queryForList(Collect.class,sql);
    }

    @Override
    public Collect getOneCollect(String cid) throws SQLException {
        String sql = "select * from collect where cid = ?";
        return queryForOne(Collect.class,sql,cid);
    }
}
